refactor(a2a.helpers): Expose routing helpers from a2a.helpers - #1143
refactor(a2a.helpers): Expose routing helpers from a2a.helpers#1143msampathkumar wants to merge 5 commits into
Conversation
This change exports several route creation functions from the top-level a2a.helpers package, making them directly importable. This simplifies the process of adding A2A routes to a FastAPI application and improves the overall modularity of the routing setup.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Reproduced the red checks against this branch. They trace back to one change: the new eager First, base installs break. Installing the branch without the http server extra and importing the package fails: On current Second, the same early import creates a cycle. The The import path changes in A lazy export keeps the nicer top-level names without either problem. Dropping the four eager imports and resolving them on access via a module _LAZY = {
'add_a2a_routes_to_fastapi': 'a2a.server.routes.fastapi_routes',
'create_agent_card_routes': 'a2a.server.routes.agent_card_routes',
'create_jsonrpc_routes': 'a2a.server.routes.jsonrpc_routes',
'create_rest_routes': 'a2a.server.routes.rest_routes',
}
def __getattr__(name):
if name in _LAZY:
import importlib
return getattr(importlib.import_module(_LAZY[name]), name)
raise AttributeError(name)I tried this against the branch to confirm it. With the four eager imports removed and the The remaining red check, |
This change exports several route creation functions from the top-level a2a.helpers package, making them directly importable.
This simplifies the process of adding A2A routes to a FastAPI application and improves the overall modularity of the routing setup.
Description
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
CONTRIBUTINGGuide.fix:which represents bug fixes, and correlates to a SemVer patch.feat:represents a new feature, and correlates to a SemVer minor.feat!:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the!) and will result in a SemVer major.bash scripts/format.shfrom the repository root to format)Fixes #<issue_number_goes_here> 🦕